package yxy.game.pm2.module.union.rank;

import org.joda.time.DateTime;

import yxy.game.pm2.bean.ServerBean;
import yxy.game.pm2.bean.area.AreaBean;
import yxy.game.pm2.bean.module.rank.PlayerRankModule;

//按区内排行：联盟等级排行
public class RankAreaLevelUnion extends UnionAreaRankModule {

	public RankAreaLevelUnion(AreaBean areaBean) {
		super(areaBean);
	}

	@Override
	public String rankName() {
		return PlayerRankModule.getAllRankNames().get(7);
	}

	@Override
	protected boolean reconsitution() {
		return false;
	}

	@Override
	protected long valuePlastic(long value) {
		return value * 10000000000000L + (10000000000000L - DateTime.now().getMillis());// 13位时间戳长度
	}

	@Override
	protected long valueRestore(long score) {
		return score / 10000000000000L;
	}

	static public RankAreaLevelUnion get(int serverId) {
		ServerBean serverBean = ServerBean.get(serverId);
		AreaBean areaBean = AreaBean.get(serverBean.getAreaId());
		if (areaBean == null) {
			return null;
		}
		return new RankAreaLevelUnion(areaBean);
	}
}
